import { defHttp } from '../http'
import type { CommonAPI } from '../model/_utils'

// 获取管理员列表
export const adminListApi: CommonAPI<'/v1/admin', 'get'> = params =>
  defHttp.get('/admin', { params })

// 新增管理员
export const postAdminApi: CommonAPI<'/v1/admin', 'post'> = data =>
  defHttp.post('/admin', { data })

// 修改管理员
export const putAdminApi: CommonAPI<'/v1/admin/{id}', 'put'> = data =>
  defHttp.put('/admin/' + data.id, { data })

// 删除管理员
export const deleteAdminApi: CommonAPI<'/v1/admin/{id}', 'delete'> = data =>
  defHttp.delete('/admin/' + data.id)

// 重置管理员密码
export const resetAdminPasswordApi: CommonAPI<
  '/v1/admin/{id}/password',
  'put'
> = data => defHttp.put(`/admin/${data.id}/password`, { data })

// 获取管理员登录记录列表
export const loginRecordListApi: CommonAPI<
  '/v1/admin_login_record',
  'get'
> = params => defHttp.get('/admin_login_record', { params })
